#!/bin/bash -ex

# init database for metastore
service postgresql start

sudo -u postgres createuser root -s
sudo -u postgres psql -c "ALTER ROLE root WITH PASSWORD 'root';"
sudo -u postgres psql -c "ALTER SYSTEM SET max_connections = '1000';"

service postgresql restart

createdb metastore

source /usr/sbin/get_hive_home.sh
${HIVE_HOME}/bin/schematool -initSchema -dbType postgres
